Web API call requests are always for an Action method defined in an HttpController. The content of the request response comes from the execution result of calling the target Action method. After ASP. NET Web API successfully activates the target HttpController for the current request, the subsequent operation is to select the corresponding Action method for the request in the HttpController. [This Article has been synchronized to How ASP. NET Web API Works?]HttpActionSelector
After fully underst
ControllerRouteKey = "controller"; // Methods public ApiControllerActionSelector(); public virtual ILookup
From code 1-5, we can see that the ApiControllerActionSelector type contains two private classes, which will play an important role later.
Let's go back to the logic in code 1-4 and start from calling the SelectAction () method in the Controller action selector.
When SelectAction () is called in the ApiControllerActionSelec
Method:VaR q = Infos. Todictionary (P => P. Code );Use the query expression syntax:VaR q = (from P in Infos select P ).Todictionary (P => P. Code );Call syntaxForeach (VaR item in Q){Console. writeline (Item. Key + item. value. Name);}From the running results, we can see that the second parameter of the dictionary is the element in the original set.
(4) tolookupConverts a set to an ILookup The differences between the
data.Next, we'll create a view model that gets the data from Apiexplorer , and then pass the apiexplorer object directly to the MVC view. However, encapsulating the apiexplorer in a model allows us to maintain the data more flexibly. namespace Helpdemo.models {using System; Using System.Collections.Generic; Using System.Linq; Using System.Web.Http.Controllers; Using System.Web.Http.Description; public class Apimodel {Iapiexplorer _explorer; Public Apimodel (Iapiexplorer
System.Collections.Generic; Using System.Linq; Using System.Web.Http.Controllers; Using System.Web.Http.Description; public class Apimodel { iapiexplorer _explorer; Public Apimodel (Iapiexplorer Explorer) { if (explorer = = null) { throw new ArgumentNullException (" Explorer "); _explorer = Explorer; } Public ilookupThe Getapis method converts the collection into a
the latest MTD and jffs2 packages from the http://www.linux-mtd.infradead.org. The package also contains Kernel patches and MTD-related tools. The major patch is ilookup-2.4.23.patch, because an ILookup () function is used in the latest MTD driver. After completing the patch, updating the MTD driver and jffs2 file system, I began to write my own NAND Flash Driver. If you do not want to use jffs2 as the roo
Httpactiondescriptor's Executeasync method implements the action, which supports different HTTP methods in 7, which by default is post. The Httpactionselector component implements the selection of the target action, the return value of the method getactionmapping is a ilookup
Parsing of model meta-data
Basically consistent with MVC
Action parameter Binding
With Httpparameterdescriptor, httpactionbinding, the
type or its subtype, add it to the return set)
Sort (note that the sorting method is replaced by iorderedenumerable inherited from ienumerable)
Orderby (two reloads), orderbydescending (two reloads), reverse (nothing else, that is, reverse the order of ienumerable), thenby, thenbydescending (these two are extension methods for iorderedenumerable, so they can only be used after orderby, and its function is to sort by a key in a sorted Series)
Group
two sets check if two collections overlap interface derived from Icollection interface
Idictionary
the Idictionary . all keys and values can be accessed using this interface. , indexers that use key types can access certain items , you can also add or remove certain items
Ilookup
The ilookupinterface is similar to the idictionary interface , A collection that implements the interface has keys and val
convenience of access, because the element can be accessed either by index or by key.
6. NET container-related interfaces
Interface
Description
ienumerable
Implementing the Foreach statement requires implementing this interface, and the interface method GetEnumerator returns an enumerator.
icollection
Method: Count property, CopyTo (Array), Add, Remove, Clear
ilist
Defines the Indexer,insert, RemoveAt Method, inherited icollec
time, we need to modify the configuration file. Otherwise, you will find that its API name is changed to the controller name.
Find the path App_Start/WebApiConfig. cs and modify the Register function as follows:
name: routeTemplate: defaults: { id = }
Refresh the page:
OK. This is what I want.
For personalization, I need to modify the title and the content of the introduction section, find the file: Area/Views/Help/I
HttpActionSelector has two basic methods. GetActionMapping returns the httping of HttpActionDescriptor and Action names of all Action methods defined in the target HttpController. Specifically, this method returns an ILookup
ApiControllerActionSelector filters the Action names provided by the request in the first round. Specifically, it first extracts the HttpRouteData object used to encapsulate route data from the specified HttpControllerContext. i
of Net Core provide support for the same platform during the same release cycle, in which case patches and updates are released in a small, separate package. Because of this small range of changes, patch validation and related work can be limited to the requirements of a single platform and class library, so that work can be minimized.The following is a list of. Net Core packages based on the NuGet library:
Sytem.runtime-the most basic. Net Core package that contains object,string,arra
car, and the value type should be a racer. To make this selection, you can send a key and an element selector to an overloaded version of The tolookup () method. The key selector represents the car attribute, and the element selector represents the racer attribute.
ILookup {Car = C, Racer = r}). tolookup (Cr => Cr. Car, Cr => Cr. Racer );If (racers. Contains ("Williams ")){Foreach (VAR William amsracer in racers ["Williams"]){Response. Write (Willia
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.